class CreateContentVersions < ActiveRecord::Migration
  def self.up
    create_table :content_versions do |t|
      t.integer   :content_raw_id
      t.datetime   :version_date ,  :default => Time.now
      t.string   :subject
      t.binary   :body
      t.string :editorial_status
      t.integer :editor_id
      #TODO write a trigger to change the editorial status date on edit
      t.datetime   :editorial_status_date
      
      # only for articles
      # isActive checks whether the current version  is active or not
      # if isActive == 't' => the current_version is the active version for the content_raw
      # otherwise there may be some other version of the content_raw active.
      t.string  :isActive
      
      t.timestamps
    end
  end

  def self.down
    drop_table :content_versions
  end
end
